"""
用户组管理视图
"""
from rest_framework.response import Response
from django.contrib.auth.models import Group, Permission
from rest_framework.viewsets import ModelViewSet
from meiduo_admin.serializers.groups_serializers import *
from meiduo_admin.serializers.permission_serializers import *
from meiduo_admin.paginations import MyPage
class GroupsView(ModelViewSet):
    queryset = Group.objects.all()
    serializer_class = GroupsSerializer
    pagination_class = MyPage

    def simple(self, request):
        groups = Permission.objects.all()
        serializer = PermissionSerializer(instance=groups, many=True)
        data = serializer.data
        return Response(data)

